package com.jiuqian.demo.config;

import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.data.redis.core.RedisTemplate;

import com.jiuqian.common.core.config.RedisRepository;

@Configuration
@EnableCaching
public class RedisConfig {

	@Bean
	@SuppressWarnings({ "unchecked", "rawtypes" })
	public RedisRepository redisRepository(RedisTemplate redisTemplate) {
		return new RedisRepository(redisTemplate);
	}

	@Bean
	@SuppressWarnings("rawtypes")
	public CacheManager cacheManager(RedisTemplate redisTemplate) {
		RedisCacheManager rcm = new RedisCacheManager(redisTemplate);
		return rcm;
	}
}
